package avicit.bdp.dds.server.master.dispatch.context;


import avicit.bdp.dds.remote.command.Command;
import avicit.bdp.dds.remote.utils.Host;
import avicit.bdp.dds.server.master.dispatch.enums.ExecutorType;

import static avicit.bdp.dds.common.Constants.DEFAULT_WORKER_GROUP;

/**
 *  execution context
 */
public class ExecutionContext {

    /**
     * host
     */
    private Host host;

    /**
     *  command
     */
    private final Command command;

    /**
     *  executor type : worker or client
     */
    private final ExecutorType executorType;

    /**
     *  worker group
     */
    private String workerGroup;


    public ExecutionContext(Command command, ExecutorType executorType) {
        this(command, executorType, DEFAULT_WORKER_GROUP);
    }

    public ExecutionContext(Command command, ExecutorType executorType, String workerGroup) {
        this.command = command;
        this.executorType = executorType;
        this.workerGroup = workerGroup;
    }

    public Command getCommand() {
        return command;
    }

    public ExecutorType getExecutorType() {
        return executorType;
    }

    public void setWorkerGroup(String workerGroup) {
        this.workerGroup = workerGroup;
    }


    public String getWorkerGroup(){
        return this.workerGroup;
    }

    public Host getHost() {
        return host;
    }

    public void setHost(Host host) {
        this.host = host;
    }
}
